package org.jeecg.enums.car;

/**
 * 商户优惠券类型
 */
public enum CarDerateTypeEnum {
    CAR_DERATE_TYPE_0(0, "普通优惠券"),
    CAR_DERATE_TYPE_1(1, "系统发放"),
    CAR_DERATE_TYPE_2(2, "物业发放优惠券"),
    CAR_DERATE_TYPE_3(3, "商家即时减免"),
    ;

    private Integer code;
    private String desc;

    CarDerateTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        CarDerateTypeEnum[] enums = values();
        for (CarDerateTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        CarDerateTypeEnum[] enums = values();
        for (CarDerateTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
